From: robertl Date: Sun, 4 Apr 2010 19:31:34 +0000 (+0000) Subject: Finish converting tracks to courses on upload. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~199^2~27 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=694edeee65ccb227766412eb4f8d2ac92e462068;p=gpsbabel.git Finish converting tracks to courses on upload. --- diff --git a/jeeps/gps.h b/jeeps/gps.h index 92d932a7b..f09007908 100644 --- a/jeeps/gps.h +++ b/jeeps/gps.h @@ -95,12 +95,14 @@ typedef struct GPS_STrack int temperature_populated; /* True if above is valid. */ unsigned char heartrate; /* Heartrate as in Garmin 301 */ unsigned char cadence; /* Crank cadence as in Edge 305 */ + unsigned int wsensor_pres:1; /* Wheel sensor present */ unsigned int tnew:1; /* New track? */ unsigned int ishdr:1; /* Track header? */ unsigned int no_latlon:1; /* True if no valid lat/lon found. */ int32 dspl; /* Display on map? */ int32 colour; /* Colour */ float distance; /* distance traveled in meters.*/ + int distance_populated; /* True if above is valid. */ char trk_ident[256]; /* Track identifier */ } GPS_OTrack, *GPS_PTrack; diff --git a/jeeps/gpsapp.c b/jeeps/gpsapp.c index 5525ea2fe..f14153fc1 100644 --- a/jeeps/gpsapp.c +++ b/jeeps/gpsapp.c @@ -3992,7 +3992,7 @@ int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid, *trkpt = *(trk[j]); trkpt->no_latlon = 1; trkpt->alt = 1e25; - trkpt->distance = 1e25; + trkpt->distance_populated = 0; trkpt->heartrate = 0; trkpt->cadence = 0xff; trk = xrealloc(trk, (n+1) * sizeof(GPS_PTrack)); @@ -4199,11 +4199,9 @@ void GPS_D301b_Get(GPS_PTrack *trk, UC *data) (*trk)->Time = GPS_Math_Gtime_To_Utime((time_t)t); p+=sizeof(uint32); - /* FIXME: check validity */ (*trk)->alt = GPS_Util_Get_Float(p); p+=sizeof(float); - /* FIXME: check validity */ (*trk)->dpth = GPS_Util_Get_Float(p); p+=sizeof(float); @@ -4242,11 +4240,9 @@ void GPS_D302b_Get(GPS_PTrack *trk, UC *data) (*trk)->Time = GPS_Math_Gtime_To_Utime((time_t)t); p+=sizeof(uint32); - /* FIXME: check validity */ (*trk)->alt = GPS_Util_Get_Float(p); p+=sizeof(float); - /* FIXME: check validity */ (*trk)->dpth = GPS_Util_Get_Float(p); p+=sizeof(float); @@ -4324,11 +4320,7 @@ void GPS_D303b_Get(GPS_PTrack *trk, UC *data) (*trk)->Time = GPS_Math_Gtime_To_Utime((time_t)t); p+=sizeof(uint32); - /* When latitude and longitude are undefined, this field seems to be - * a constant on my receiver (51 59 04 69) */ - /* FIXME: check validity */ (*trk)->alt = GPS_Util_Get_Float(p); - if (lat_undefined || lon_undefined) (*trk)->alt = 0.0f; p+=sizeof(float); /* Heartrate is reported as 0 if there is no signal from @@ -4338,6 +4330,7 @@ void GPS_D303b_Get(GPS_PTrack *trk, UC *data) switch (gps_trk_type) { case pD304: (*trk)->distance = GPS_Util_Get_Float(p); + (*trk)->distance_populated = ((*trk)->distance <= 1e24); p+=sizeof(float); /* A float indicating number of meters travelled. */ (*trk)->heartrate = (*p++); @@ -4345,10 +4338,10 @@ void GPS_D303b_Get(GPS_PTrack *trk, UC *data) if (*p != 0xff) { (*trk)->cadence = (*p); } - - /* sensor present. Boolean */ p++; - + + (*trk)->wsensor_pres = (*p++); + break; case pD303: (*trk)->heartrate = *p++; @@ -4496,7 +4489,7 @@ void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid) p+=sizeof(float); if (protoid == 304) { - GPS_Util_Put_Float(p, 1.0e25f); /* Distance, not supported for now */ + GPS_Util_Put_Float(p, trk->distance_populated ? trk->distance : 1e25); p+=sizeof(float); } @@ -4507,7 +4500,7 @@ void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid) *p = trk->cadence > 0 ? trk->cadence : 0xff; p+=sizeof(char); - *p = 0; /* Wheel sensor present, not supported for now */ + *p = trk->wsensor_pres; p+=sizeof(char); } diff --git a/trackfilter.c b/trackfilter.c index 9eced4780..2ea676e44 100644 --- a/trackfilter.c +++ b/trackfilter.c @@ -245,6 +245,12 @@ trackfilter_fill_track_list_cb(const route_head *track) /* callback for track_d if ((track->rte_name == NULL) || (case_ignore_str_match(track->rte_name, opt_name) == 0)) { + QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) + { + waypoint *wpt = (waypoint *)elem; + track_del_wpt((route_head *)track, wpt); + waypt_free(wpt); + } track_del_head((route_head *)track); return; } @@ -399,7 +405,8 @@ trackfilter_pack(void) QUEUE_FOR_EACH((queue *)&curr->waypoint_list, elem, tmp) { waypoint *wpt = (waypoint *)elem; - route_add_wpt(master, waypt_dupe(wpt)); + track_del_wpt(curr, wpt); + track_add_wpt(master, wpt); } track_del_head(curr); track_list[i].track = NULL; diff --git a/xmldoc/formats/garmin.xml b/xmldoc/formats/garmin.xml index bcbd23123..9a1f5e94f 100644 --- a/xmldoc/formats/garmin.xml +++ b/xmldoc/formats/garmin.xml @@ -185,7 +185,15 @@ GPX files from the mass storage device as mounted on your computer. while we do extract data such as heart rate and temperature from tracks on the sporting models like Edge and Forerunner, GPSBabel is not a fitness program at its core and does not support features - like courses or calorie/fitness zone data. + like workouts or calorie/fitness zone data. Furthermore, sporting + models don't support track upload. When trying to upload tracks to + these devices, GPSBabel converts them to courses on the fly and + uploads these instead. When uploading waypoints at the same + time, these are converted to course points by mapping them to the + nearest track point on the track/course (no matter how far away from + the track they are). Since course point creation requires time + stamps for the track points, they are created automatically assuming + a speed of 10 km/h for tracks that lack them.